﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace UTC_Project_Manager.Controls
{
    /// <summary>
    /// Interaction logic for VerticalMenuControl.xaml
    /// </summary>
    public partial class VerticalMenuControl : UserControl
    {
        ReunionControl reunionControl;

        public VerticalMenuControl()
        {
            InitializeComponent();
            reunionControl = new ReunionControl();
            MainControl.highlightSettingTabEvent += new MainControl.HighlightSettingsTab(MainControl_highlightSettingTabEvent);
        }

        private void TabControl_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            TabItem item = e.Source as TabItem;
            int index = Convert.ToInt32(item.Tag.ToString());
            if (index == 0)
            {
                ((MainControl)((Grid)((LeftControl)((Grid)this.Parent).Parent).Parent).Parent).AccueilGrid.Children.Clear();
                ((MainControl)((Grid)((LeftControl)((Grid)this.Parent).Parent).Parent).Parent).AccueilGrid.Children.Add(MainControl.accueilControl);
            }
            else if (index == 1)
            {
                ((MainControl)((Grid)((LeftControl)((Grid)this.Parent).Parent).Parent).Parent).AccueilGrid.Children.Clear();
                ((MainControl)((Grid)((LeftControl)((Grid)this.Parent).Parent).Parent).Parent).AccueilGrid.Children.Add(reunionControl);
            }
            else if (index == 2)
            {
                ((MainControl)((Grid)((LeftControl)((Grid)this.Parent).Parent).Parent).Parent).AccueilGrid.Children.Clear();
                ((MainControl)((Grid)((LeftControl)((Grid)this.Parent).Parent).Parent).Parent).AccueilGrid.Children.Add(MainControl.settingsControl);
            }
        }

        void MainControl_highlightSettingTabEvent()
        {
            // Highlight Settings tab
            this.TabControl.SelectedIndex = 2;
        }
    }
}
